package com.cmy.framework_base.app

import android.content.Context
import androidx.startup.Initializer
import com.kingja.loadsir.core.LoadSir
import com.cmy.framework_base.common.loadsir.EmptyCallback
import com.cmy.framework_base.common.loadsir.ErrorCallback
import com.cmy.framework_base.common.loadsir.LoadingCallback
import com.cmy.framework_utils.log.KLog

/**
 * @name:
 *  LazyInitializer
 * @package:
 *  com.cmy.framework_base
 * @date:
 *  2023/2/1616:29
 * @author
 *    cmy
 * @description
 *  初始化各个三方sdk
 */
class LazyInitializer :Initializer<Unit>  {
    override fun create(context: Context) {
        KLog.init(true)
        initLoadSir()
    }

    override fun dependencies(): List<Class<out Initializer<*>>> {
        return emptyList()
    }


    /**
     * 初始化状态加载
     */
    private fun initLoadSir(){
        LoadSir.beginBuilder()
            .addCallback(LoadingCallback())
            .addCallback(EmptyCallback())
            .addCallback(ErrorCallback())
            .setDefaultCallback(LoadingCallback::class.java)
            .commit()
    }

}